package com.hsd.entity;

import javax.persistence.*;
import java.sql.Timestamp;

@Entity
@Table(name = "t_log", schema = "atm", catalog = "")
public class Log {
    private int id;
    private String type;
    private Double money;
    private Timestamp time;
    private String acc;

    public Log() {
    }

    public Log(String type, Double money, String acc) {
        this.type = type;
        this.money = money;
        this.acc = acc;
    }

    @Id
    @Column(name = "l_id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "l_type")
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Basic
    @Column(name = "l_money")
    public Double getMoney() {
        return money;
    }

    public void setMoney(Double money) {
        this.money = money;
    }

    @Basic
    @Column(name = "l_time")
    public Timestamp getTime() {
        return time;
    }

    public void setTime(Timestamp time) {
        this.time = time;
    }

    @Basic
    @Column(name = "l_acc")
    public String getAcc() {
        return acc;
    }

    public void setAcc(String acc) {
        this.acc = acc;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Log log = (Log) o;

        if (id != log.id) return false;
        if (type != null ? !type.equals(log.type) : log.type != null) return false;
        if (money != null ? !money.equals(log.money) : log.money != null) return false;
        if (time != null ? !time.equals(log.time) : log.time != null) return false;
        if (acc != null ? !acc.equals(log.acc) : log.acc != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (type != null ? type.hashCode() : 0);
        result = 31 * result + (money != null ? money.hashCode() : 0);
        result = 31 * result + (time != null ? time.hashCode() : 0);
        result = 31 * result + (acc != null ? acc.hashCode() : 0);
        return result;
    }
}
